package task11;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-09-22
 * Time:21:50
 */
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Demo2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n=in.nextInt();
            int max=0;
            int count=0;
            String str=Integer.toString(n,2);
            for (int i = 0; i < str.length(); i++) {
                if(str.charAt(i)=='1'){
                    count++;
                }else{
                    if(count>max){
                        max=count;
                    }
                    count=0;
                }
            }
            if(count>max){
                max=count;
                count=0;
            }
            System.out.println(max);
        }
    }
}